var fileArr = new Array();
jQuery(function($){
    Dropzone.autoDiscover = false;
    Dropzone.options.myAwesomeDropzone = false;
    $(".dropzone").dropzone({
        url:Site("uploadAttachment"),
        method:"post",
        paramName:"file",   //后端同学的字段
        autoProcessQueue:true,//自动上传
        maxFilesize:1024, // MB
        uploadMultiple:false,
        parallelUploads:10,
        acceptedFiles:".doc,.wps,.xls,.pdf,.jpg",
        dictInvalidFileType:"支持的文件类型是.doc,.wps,.xls,.pdf,.jpg",
        addRemoveLinks:true,
        dictRemoveFile:"移除文件",
        dictUploadCanceled:"取消",
        dictDefaultMessage:
            "<span class='bigger-150 bolder'><i class='icon-caret-right red'></i>拖动文件</span>上传\
            <span class='smaller-80 gre'>(或者点击上传)</span> <br /> \
            <i class='upload-icon icon-cloud-upload blue icon-3x'></i>",
        dictResponseError:"文件上传失败!",
        dictFileTooBig:"文件过大,上传失败!",
        init:function(){
            this.on("addedfile",function(file,data) {
                fileArr.push(file.upload.uuid);
                //解决点击时重复发送请求
                $(".dz-remove").each(function(index) {
                    console.log(index)
                    if(!$(".dz-remove:eq(" + index + ")").attr("id")) {
                        $(".dz-remove:eq(" + index + ")").attr("id",fileArr[index]);
                    }
                })

            })
            this.on("success",function(file,data){
                //var myDropzone = this;
                console.log("success:",data)

            });
            this.on("error", function () {
                console.log("++",arguments)
            })
            this.on("removedfile",function(file,data){
                console.log("remove")
                this.removeFile(file);
            })
        }
    });


});